package com.wjc.myktapplication

import android.os.Bundle
import com.wjc.basemodule.base.BaseActivity
import com.wjc.basemodule.base.DataBindingConfig
import com.wjc.database.UserHelper
import com.wjc.myktapplication.databinding.ActivityMainBinding
import com.wjc.basemodule.widget.DialogManagerKt


class MainActivity : BaseActivity<ActivityMainBinding>() {
    val TAG = "MainActivity"

    override val dataBindingConfig: DataBindingConfig
        get() = DataBindingConfig(R.layout.activity_main)


    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        lifecycle.addObserver(DialogManagerKt(this.javaClass.name))
       UserHelper().insertUser()

    }

//    override fun onBackPressed() {
//        //获取hostFragment
//        val mMainNavFragment: Fragment? =
//            supportFragmentManager.findFragmentById(R.id.nav_host_fragment)
//        //获取当前所在的fragment
//        val fragment =
//            mMainNavFragment?.childFragmentManager?.primaryNavigationFragment
//        //如果当前处于根fragment即HostFragment
//        if (fragment is MainHomeFragment) {
//            //Activity退出但不销毁
//            moveTaskToBack(false)
//        } else {
//            super.onBackPressed()
//        }
//    }


}

